<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 				prefix="c" %>
<%@ taglib uri="http://displaytag.sf.net" 						prefix="display" %>
<%@ taglib uri="/struts-tags" 									prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" 				prefix="fmt"%>

<link rel="stylesheet" href="styles/form-input.css" type="text/css" media="all" />
<link type="text/css" rel="stylesheet" href="js/jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css"/>
<script type="text/javascript" src="js/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/block/jquery.blockUI.js"></script>
<script type="text/javascript">
	function buttonDisable(){
		block();
		document.mainForm.submit();
	}
	function block() { 
        $.blockUI({ css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#000', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: .5, 
            color: '#fff' 
    }});}
	$(function() {
		var dates = $( "#fromDate" ).datepicker({
			dateFormat: 'd MM, yy',
			showAnim: 'fold', 
			changeMonth: true,
			numberOfMonths: 1,
			changeYear: true,
			yearRange: '1958:2020',
			onSelect: function( selectedDate ) {
				var option = this.id == "fromDate" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
						date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat,
							selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	});
	$(document).ready(function() {
   		$("button").button();
	});
</script>

	<br><br>
	<div class="error-text"><s:actionerror /></div>
	<div class="error-text"><s:fielderror /></div>
	<div class="message-text"><s:actionmessage /></div>
	
	<div align="center">
		<s:form id="mainForm" action="manual-DL" theme="simple" method="POST" >
			<fieldset style="width:470px;">
				<legend><h3>Manual Download</h3></legend>
				<br>
				<div align="left">
					Daily Fail Download Date
					<table cellpadding="7">
						<tr><td>For Open Date Account</td><td><s:textfield name="fromDate" id="fromDate"/></td></tr>
						<tr></tr>
						<tr><td></<td><td><s:submit id="submit" type="button" onclick="javascript:buttonDisable();">submit</s:submit></td></tr>
					</table>		
					<%--onclick="return buttonDisable();" --%>			
				</div>				
			</fieldset>			
		</s:form>
	</div>
	<br><br>
	<div>
		<display:table 	id			= "log"
              			name       	= "${downloadLogs}"
             			pagesize   	= "10" style="width: 800px"
              			requestURI 	= "/manual-DL-form" class="display">
	            				
   			<display:column title	= "No." style="width: 7%"
              				value   = "${log_rowNum}" />              				 
		   
		   	<display:column title 	= "Open Account"
		   					value	= "${log.downloadForDate}"
		   					nulls	= "false" sortable="true" format="{0,date,dd-MMM-yyyy}" />

		   	<display:column title 	= "Username"
		   					value	= "${log.username}" 
		   					nulls	= "false" sortable="true" />
		   	
		   	<display:column title 	= "Start DL"
		   					value	= "${log.createdDate}" 
		   					nulls	= "false" sortable="true" format="{0,date,dd-MMM-yyyy HH:mm:ss}" />
		   					
		   	<display:column title 	= "Detail" sortable="true" >
		   		<c:choose>
		   			<c:when test="${log.exception != null}">
						<c:url var="urlLog" value="logDetail">
							<c:param name="logId" value="${log.id}" />
						</c:url>
						<a href="${urlLog}">${log.detail}</a>	
					</c:when>
					<c:otherwise>${log.detail}</c:otherwise>
				</c:choose>
			</display:column>
		    
		    <display:column title 	= "Finish DL"
		   					value	= "${log.finishedDate}" 
		   					nulls	= "false" sortable="true" format="{0,date,dd-MMM-yyyy HH:mm:ss}" />
		</display:table>
	</div>